use serde::{Deserialize, Serialize};
use validator::Validate;

#[derive(Serialize, Deserialize, Validate, Debug, Clone, Default)]
pub struct AddParams {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub config: Option<WireguardConfigAddParams>,
}

#[derive(Serialize, Deserialize, Validate, Debug, Clone, Default)]
#[serde(rename_all(serialize = "PascalCase", deserialize = "PascalCase"))]
pub struct WireguardConfigAddParams {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub interface: Option<WireguardConfigInterfaceAddParams>,
}

#[derive(Serialize, Deserialize, Validate, Debug, Clone, Default)]
#[serde(rename_all(serialize = "PascalCase", deserialize = "PascalCase"))]
pub struct WireguardConfigInterfaceAddParams {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub listen_port: Option<u16>,
}

#[derive(Serialize, Deserialize, Validate, Debug, Clone, Default, Eq, PartialEq)]
pub struct Filter {
    pub endpoint_id: Option<String>,
}

#[derive(Serialize, Deserialize, Validate, Debug, Clone, Default, Eq, PartialEq)]
pub struct UpdateParams {
    pub config: Option<WireguardConfigUpdateParams>,
}

#[derive(Serialize, Deserialize, Validate, Debug, Clone, Default, Eq, PartialEq)]
#[serde(rename_all(serialize = "PascalCase", deserialize = "PascalCase"))]
pub struct WireguardConfigUpdateParams {
    pub interface: Option<WireguardInterfaceConfigUpdateParams>,
}

#[derive(Serialize, Deserialize, Validate, Debug, Clone, Default, Eq, PartialEq)]
#[serde(rename_all(serialize = "PascalCase", deserialize = "PascalCase"))]
pub struct WireguardInterfaceConfigUpdateParams {
    pub listen_port: Option<Option<u16>>,
}
